import React from 'react'
import {useLocation,useParams} from "react-router-dom"

export default function News() {
  const location = useLocation()
  const params=useParams()
  const {state}=location
  return (
    <div>
      {state.map(item=>{
        return <div key={item.id}>{item.name}</div>
      })}
      <div>params参数是{params.id}</div>
    </div>
  )
}
